{extend name="common/visitor_iframe" /}

{block name="style"}
<style media="screen">
	.el-card{
		height:100%;
	}
	.el-card__body{
		overflow-x:hidden;
		overflow-y:auto;
	}
</style>
{/block}

{block name="ct"}
<el-card>
	<div slot="header">
		<span>完善信息</span>
		<el-button style="float: right;" size="mini" plain @click="history.go(-1)">返回</el-button>
		<el-button style="float: right;margin-right:10px;" size="mini" plain
			icon="el-icon-refresh" @click="window.location.reload();"></el-button>
	</div>
	<el-form ref="form" :model="form" label-width="80px" inline>
		<el-form-item label=" ">
		<img src="{$Visitor.head}" width="100" height="100">
		</el-form-item><br>
		<el-form-item label="昵称">
			<el-input v-model="form.nick_name"></el-input>
		</el-form-item><br>
		<el-form-item label="登录邮箱">
			<el-input v-model="form.email" disabled></el-input>
		</el-form-item><br>
		<el-form-item label="登录账号">
			<el-input v-model="form.user_name" disabled></el-input>
		</el-form-item><br>
		<el-form-item label=" ">
			<el-button type="primary" @click="onSubmit">保存</el-button>
			<el-button @click="history.go(-1)">返回</el-button>
		</el-form-item>
	</el-form>
</el-card>
{/block}

{block name="script"}
<script type="text/javascript">
var main = new Vue({
	el:"#main",
	data:{
		form: {
          	nick_name:'{$Visitor.nick_name}',
			email:'{$Visitor.email}',
			user_name:'{$Visitor.user_name}',
        }
	},
	methods:{
		onSubmit() {
			var param = this.form;
			$.post("./editInfo",param,function(res) {
				if(res.code == 1){
					main.$message({message:res.msg,type:"success"});
				}else{
					main.$message({message:res.msg,type:"danger"});
				}
			})
		}
	}
})
</script>
{/block}
